package nsn.message.aggregator.model;

import java.util.Date;



/**
 * 
 * 
 * @author Lukasz Nowak
 * @since 10-03-2011
 * 
 */
public class Entry implements IEntry {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4702274480295022542L;
	private String _title;
	private String _content;
	private String _author;
	private Date _date;
	private Source _source;

	@Override
	public boolean equals(final Object obj){
		if(obj instanceof Entry){
			final Entry entry = (Entry) obj;
			return getTitle().equals(entry.getTitle());
		}
		return false;
	}
	
	@Override
	public int hashCode(){
		return _title.hashCode();
	}
	
	@Override
	public Date getPublishedDate() {
		return _date;
	}

	/**
	 * 
	 * 
	 * @param date
	 *            the date to set
	 */
	public void setPublishedDate(final Date date) {
		_date = date;
	}

	@Override
	public String getTitle() {
		return _title;
	}

	/**
	 * 
	 * 
	 * @param title
	 *            the title to set
	 */
	public void setTitle(final String title) {
		_title = title;
	}

	@Override
	public String getContent() {
		return _content;
	}

	/**
	 * 
	 * 
	 * @param content
	 *            the content to set
	 */
	public void setContent(final String content) {
		_content = content;
	}

	@Override
	public String getAuthor() {
		return _author;
	}

	/**
	 * 
	 * 
	 * @param author
	 *            the author to set
	 */
	public void setAuthor(final String author) {
		_author = author;
	}

	@Override
	public ISource getSource() {
		return _source;
	}

	/**
	 * 
	 * 
	 * @param source
	 *            the source to set
	 */
	public void setSource(final Source source) {
		_source = source;
	}
	


	@Override
	public void delete() {
		_source.delete(this);
	}
	


}
